package nowCoder;

import java.util.Scanner;

/**
 * @Auther: zzx
 * @Date: 2024.02.24/2/25
 */
public class HJ63 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String x = sc.nextLine();
        int y = sc.nextInt();
        int l = 0;
        String str = x;
        for (int i = 0; i < x.length() - y; i++) {
            String s = x.substring(i,i+y);
            int ll = 0;
            for (int j = 0; j < y; j++) {
                if (s.charAt(j) == 'G' || s.charAt(j) == 'C'){
                    ll++;
                }
            }
            if (ll > l){
                l = ll;
                str = s;
            }
        }
        System.out.println(str);
    }
}
